package com.example.human_resource_management.entry.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;

import com.example.human_resource_management.entry.dto.EmployeeDto;
import lombok.Data;

/**
 * 员工表
 * @TableName employee
 */
@TableName(value ="employee")
@Data
public class Employee {
    /**
     * 唯一标识员工
     */
    @TableId(type = IdType.AUTO)
    private Long empId;

    /**
     * 员工姓名
     */
    private String name;

    /**
     * 性别（如“男/女”）
     */
    private String gender;

    /**
     * 所属部门ID，外键关联部门表
     */
    private Long deptId;

    /**
     * 所属职位ID，外键关联职位表
     */
    private Long posId;

    /**
     * 入职日期
     */
    private Date hireDate;

    /**
     * 联系方式（如手机号）
     */
    private String contact;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Employee other = (Employee) that;
        return (this.getEmpId() == null ? other.getEmpId() == null : this.getEmpId().equals(other.getEmpId()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getGender() == null ? other.getGender() == null : this.getGender().equals(other.getGender()))
            && (this.getDeptId() == null ? other.getDeptId() == null : this.getDeptId().equals(other.getDeptId()))
            && (this.getPosId() == null ? other.getPosId() == null : this.getPosId().equals(other.getPosId()))
            && (this.getHireDate() == null ? other.getHireDate() == null : this.getHireDate().equals(other.getHireDate()))
            && (this.getContact() == null ? other.getContact() == null : this.getContact().equals(other.getContact()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getEmpId() == null) ? 0 : getEmpId().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getGender() == null) ? 0 : getGender().hashCode());
        result = prime * result + ((getDeptId() == null) ? 0 : getDeptId().hashCode());
        result = prime * result + ((getPosId() == null) ? 0 : getPosId().hashCode());
        result = prime * result + ((getHireDate() == null) ? 0 : getHireDate().hashCode());
        result = prime * result + ((getContact() == null) ? 0 : getContact().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", empId=").append(empId);
        sb.append(", name=").append(name);
        sb.append(", gender=").append(gender);
        sb.append(", deptId=").append(deptId);
        sb.append(", posId=").append(posId);
        sb.append(", hireDate=").append(hireDate);
        sb.append(", contact=").append(contact);
        sb.append("]");
        return sb.toString();
    }
}